3.7.68 \(\int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx\) [668]

3.7.68.1 Optimal result
3.7.68.2 Mathematica [A] (verified)
3.7.68.3 Rubi [A] (verified)
3.7.68.4 Maple [A] (verified)
3.7.68.5 Fricas [A] (verification not implemented)
3.7.68.6 Sympy [B] (verification not implemented)
3.7.68.7 Maxima [A] (verification not implemented)
3.7.68.8 Giac [A] (verification not implemented)
3.7.68.9 Mupad [B] (verification not implemented)

3.7.68.1 Optimal result

Integrand size = 39, antiderivative size = 66 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=\frac {a A c^2 \tan (e+f x)}{f}-\frac {a (i A-B) c^2 \tan ^2(e+f x)}{2 f}-\frac {i a B c^2 \tan ^3(e+f x)}{3 f} \]

output
a*A*c^2*tan(f*x+e)/f-1/2*a*(I*A-B)*c^2*tan(f*x+e)^2/f-1/3*I*a*B*c^2*tan(f* 
x+e)^3/f
 
3.7.68.2 Mathematica [A] (verified)

Time = 1.94 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.82 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=\frac {a c^2 \left (-2 B+6 A \tan (e+f x)+3 (-i A+B) \tan ^2(e+f x)-2 i B \tan ^3(e+f x)\right )}{6 f} \]

input
Integrate[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x 
])^2,x]
 
output
(a*c^2*(-2*B + 6*A*Tan[e + f*x] + 3*((-I)*A + B)*Tan[e + f*x]^2 - (2*I)*B* 
Tan[e + f*x]^3))/(6*f)
 
3.7.68.3 Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 53, normalized size of antiderivative = 0.80, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.128, Rules used = {3042, 4071, 27, 49, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+i a \tan (e+f x)) (c-i c \tan (e+f x))^2 (A+B \tan (e+f x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+i a \tan (e+f x)) (c-i c \tan (e+f x))^2 (A+B \tan (e+f x))dx\)

\(\Big \downarrow \) 4071

\(\displaystyle \frac {a c \int c (1-i \tan (e+f x)) (A+B \tan (e+f x))d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {a c^2 \int (1-i \tan (e+f x)) (A+B \tan (e+f x))d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 49

\(\displaystyle \frac {a c^2 \int \left (-i B \tan ^2(e+f x)+(B-i A) \tan (e+f x)+A\right )d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a c^2 \left (-\frac {1}{2} (-B+i A) \tan ^2(e+f x)+A \tan (e+f x)-\frac {1}{3} i B \tan ^3(e+f x)\right )}{f}\)

input
Int[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2,x 
]
 
output
(a*c^2*(A*Tan[e + f*x] - ((I*A - B)*Tan[e + f*x]^2)/2 - (I/3)*B*Tan[e + f* 
x]^3))/f
 

3.7.68.3.1 Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 49
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int 
[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d}, x] 
&& IGtQ[m, 0] && IGtQ[m + n + 2, 0]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4071
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + 
 (f_.)*(x_)])*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Si 
mp[a*(c/f)   Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x], x 
, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c 
+ a*d, 0] && EqQ[a^2 + b^2, 0]
 
3.7.68.4 Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 49, normalized size of antiderivative = 0.74

method result size
derivativedivides \(-\frac {i a \,c^{2} \left (\frac {B \tan \left (f x +e \right )^{3}}{3}+\frac {\left (i B +A \right ) \tan \left (f x +e \right )^{2}}{2}+i \tan \left (f x +e \right ) A \right )}{f}\) \(49\)
default \(-\frac {i a \,c^{2} \left (\frac {B \tan \left (f x +e \right )^{3}}{3}+\frac {\left (i B +A \right ) \tan \left (f x +e \right )^{2}}{2}+i \tan \left (f x +e \right ) A \right )}{f}\) \(49\)
risch \(\frac {2 a \,c^{2} \left (3 i A \,{\mathrm e}^{2 i \left (f x +e \right )}+3 B \,{\mathrm e}^{2 i \left (f x +e \right )}+3 i A -B \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) \(56\)
norman \(\frac {a A \,c^{2} \tan \left (f x +e \right )}{f}+\frac {\left (-i A a \,c^{2}+B a \,c^{2}\right ) \tan \left (f x +e \right )^{2}}{2 f}-\frac {i a B \,c^{2} \tan \left (f x +e \right )^{3}}{3 f}\) \(64\)
parallelrisch \(-\frac {2 i a B \,c^{2} \tan \left (f x +e \right )^{3}+3 i A \tan \left (f x +e \right )^{2} a \,c^{2}-3 B \tan \left (f x +e \right )^{2} a \,c^{2}-6 A \tan \left (f x +e \right ) a \,c^{2}}{6 f}\) \(67\)
parts \(\frac {\left (-i A a \,c^{2}+B a \,c^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (-i A a \,c^{2}+B a \,c^{2}\right ) \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {\left (-i B a \,c^{2}+A a \,c^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+A a \,c^{2} x -\frac {i B a \,c^{2} \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(155\)

input
int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x,method=_RET 
URNVERBOSE)
 
output
-I/f*a*c^2*(1/3*B*tan(f*x+e)^3+1/2*(A+I*B)*tan(f*x+e)^2+I*A*tan(f*x+e))
 
3.7.68.5 Fricas [A] (verification not implemented)

Time = 0.24 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.12 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=-\frac {2 \, {\left (3 \, {\left (-i \, A - B\right )} a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-3 i \, A + B\right )} a c^{2}\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

input
integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x, algo 
rithm="fricas")
 
output
-2/3*(3*(-I*A - B)*a*c^2*e^(2*I*f*x + 2*I*e) + (-3*I*A + B)*a*c^2)/(f*e^(6 
*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)
 
3.7.68.6 Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (56) = 112\).

Time = 0.21 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.77 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=\frac {6 i A a c^{2} - 2 B a c^{2} + \left (6 i A a c^{2} e^{2 i e} + 6 B a c^{2} e^{2 i e}\right ) e^{2 i f x}}{3 f e^{6 i e} e^{6 i f x} + 9 f e^{4 i e} e^{4 i f x} + 9 f e^{2 i e} e^{2 i f x} + 3 f} \]

input
integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**2,x)
 
output
(6*I*A*a*c**2 - 2*B*a*c**2 + (6*I*A*a*c**2*exp(2*I*e) + 6*B*a*c**2*exp(2*I 
*e))*exp(2*I*f*x))/(3*f*exp(6*I*e)*exp(6*I*f*x) + 9*f*exp(4*I*e)*exp(4*I*f 
*x) + 9*f*exp(2*I*e)*exp(2*I*f*x) + 3*f)
 
3.7.68.7 Maxima [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 55, normalized size of antiderivative = 0.83 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=\frac {-2 i \, B a c^{2} \tan \left (f x + e\right )^{3} - 3 \, {\left (i \, A - B\right )} a c^{2} \tan \left (f x + e\right )^{2} + 6 \, A a c^{2} \tan \left (f x + e\right )}{6 \, f} \]

input
integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x, algo 
rithm="maxima")
 
output
1/6*(-2*I*B*a*c^2*tan(f*x + e)^3 - 3*(I*A - B)*a*c^2*tan(f*x + e)^2 + 6*A* 
a*c^2*tan(f*x + e))/f
 
3.7.68.8 Giac [A] (verification not implemented)

Time = 0.43 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.32 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=-\frac {2 \, {\left (-3 i \, A a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - 3 \, B a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - 3 i \, A a c^{2} + B a c^{2}\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

input
integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2,x, algo 
rithm="giac")
 
output
-2/3*(-3*I*A*a*c^2*e^(2*I*f*x + 2*I*e) - 3*B*a*c^2*e^(2*I*f*x + 2*I*e) - 3 
*I*A*a*c^2 + B*a*c^2)/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3 
*f*e^(2*I*f*x + 2*I*e) + f)
 
3.7.68.9 Mupad [B] (verification not implemented)

Time = 8.93 (sec) , antiderivative size = 50, normalized size of antiderivative = 0.76 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^2 \, dx=\frac {a\,c^2\,\mathrm {tan}\left (e+f\,x\right )\,\left (6\,A-A\,\mathrm {tan}\left (e+f\,x\right )\,3{}\mathrm {i}+3\,B\,\mathrm {tan}\left (e+f\,x\right )-B\,{\mathrm {tan}\left (e+f\,x\right )}^2\,2{}\mathrm {i}\right )}{6\,f} \]

input
int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)*(c - c*tan(e + f*x)*1i)^2 
,x)
 
output
(a*c^2*tan(e + f*x)*(6*A - A*tan(e + f*x)*3i + 3*B*tan(e + f*x) - B*tan(e 
+ f*x)^2*2i))/(6*f)